home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Misc / InstallerNG / examples / properties.installer < prev    next >
Text File  |  2000-01-01  |  3KB  |  87 lines

  1.  
  2. /*
  3.  *
  4.  *
  5.  */
  6.  
  7.  
  8. ; this needs the InstallerNG!
  9. (if (not @installer-ng-version)
  10.     (abort "This script needs the InstallerNG by Jens Tröger")
  11. )
  12.  
  13. ; lets go!
  14. (user expert)
  15. (set @proceed-button "Show me more!"
  16.      @abort-button "Shit happens"
  17.      @app-name "properties_example"
  18. )
  19.  
  20. ; *******************************************************************
  21.  
  22. (message "Welcome to a really cool example!\n\n"
  23.          "This will show you the usage of the new functions\n\n"
  24.          "SET-PROPERTY, GET-PROPERTY, REMOVE-PROPERTY,\n"
  25.          "READ-PROPERTY-OBJECT, SAVE-PROPERTY-OBJECT\n\n"
  26.          "which make you able to handle named attribute lists, to\n"
  27.          "read and write such a list, to add, modify and remove\n"
  28.          "attributes from/to such a list\n\n"
  29.          "Enjoy..."
  30. )
  31.  
  32. ; read the properties of this object or do nothing, if there are no
  33. ; properties stored
  34. (set #savage 0)
  35. (read-property-object #savage)
  36.  
  37. ; maybe there was nothing to read! we have to handle that special
  38. ; case by TRAP'ing the GET-PROPERTY function
  39. (trap 3 (set #pname  (get-property #savage "NAME")))
  40. (trap 3 (set #pbirth (get-property #savage "BIRTH")))
  41. (trap 3 (set #psex   (get-property #savage "SEX")))
  42.  
  43. ; modify properties
  44. (message "First, give me some data!")
  45.  
  46. ; modify #savage`s properties
  47. ; NOTE: there are TRAP functions enclosing the GET-PROPERTY functions for
  48. ;       catching the "property not found" error!
  49. (put-property #savage "NAME" (askstring (prompt "Enter the name")
  50.                                         (help "")
  51.                                         (default #pname)
  52.                              )
  53. )
  54. (put-property #savage "BIRTH" (askstring (prompt ("Enter %s's birthday" (get-property #savage "NAME")))
  55.                                          (help "")
  56.                                          (default #pbirth)
  57.                               )
  58. )
  59.  
  60. (put-property #savage "SEX" (askbool (prompt ("Enter %s's sex" (get-property #savage "NAME")))
  61.                                      (help "")
  62.                                      (default #psex)
  63.                                      (choices "Male" "Female")
  64.                             )
  65. )
  66.  
  67. ; show the properties
  68. (message "Now let's see the data...")
  69. (message "Person's properties are\n\n"
  70.          "Name: " (get-property #savage "NAME") "\n"
  71.          "Birthday: " (get-property #savage "BIRTH") "\n"
  72.          "Sex: " (if (get-property #savage "SEX")
  73.                      "Male"
  74.                      "Female"
  75.                  ) "\n"
  76. )
  77.  
  78.  
  79. ; save the objects properties
  80. (save-property-object #savage)
  81.  
  82. (exit (quiet))
  83. (welcome)
  84.  
  85.  
  86.  
  87.